<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>制作12进制的时钟特效</title>
</head>
<body>
<div id="myclock"></div>
<script type="text/javascript">
    function clock_12h()
    {
        
        
        
        /*设置div的内容为当前时间*/
        document.getElementById("myclock").innerHTML="<h2>你好，欢迎访问………！</h2><h2>"+year
                +"年"+month+"月"+date+"日&nbsp;"+hour+":"+minute+":"+second
                +"&nbsp;"+apm+"&nbsp;"+weekday+"</h2>";
    }
    /*使用setInterval()每间隔指定毫秒后调用clock_12h()*/
    var myTime = setInterval("clock_12h()",1000);
</script>
</body>
</html>
